package models;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import play.data.binding.As;
import play.data.validation.Required;
import play.db.jpa.Model;

/**
 * Class for table Cartoon.
 * 
 * @author Elisa
 */
@Entity
public class Cartoon extends Model {

	@Required
	public String title;
	@As(value={"MM/yyyy", "MM-yyyy", "MMyyyy"})
	public Date publicationdate;
	@Required
	@ManyToOne
	public Author writer;
	@Required
	@ManyToOne
	public Author cartoonist;
	@ManyToOne
	public Author color;
	@ManyToOne
	public Collection collection;
	public Integer volume;

	@OneToMany(mappedBy = "cartoon")
	public List<Cover> covers = new ArrayList<Cover>();
	


}
